﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text.Json.Serialization;
using System.Threading.Tasks;
using FreeSql.DataAnnotations;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;

namespace Bzzb.Model
{
    [Table(Name = "baozhangzhuangbeitype")]
    public class BaoZhangZhuangBeiType
    {
        [Column(IsIdentity = true, IsPrimary = true, Name = "id")]
        [JsonProperty("id")]
        public long Id { get; set; }

        [Column(Name = "name")]
        [JsonProperty("name")]
        public string Name { get; set; }

        [Column(Name = "gzfieldinfo", StringLength = -1)]
        [Description("故障字段信息json格式")]
        [JsonProperty("gzfieldinfo")]
        public string Gzfieldinfo { get; set; }

        [Column(Name = "gjfieldinfo", StringLength = -1)]
        [Description("构件字段信息json格式")]
        [JsonProperty("gjfieldinfo")]
        public string Gjfieldinfo { get; set; }

        [Column(Name = "gzfieldinfo_json", StringLength = -1, IsIgnore = true)]
        [Description("故障字段信息json格式")]
        [JsonProperty("gzfieldinfo_json")]
        public JObject GzfieldinfoJson { get { return this.Gzfieldinfo == null ? null : JObject.Parse(this.Gzfieldinfo); } }

        [Column(Name = "created", ServerTime = DateTimeKind.Local, CanUpdate = false, DbType = "datetime(0) NOT NULL")]
        [JsonProperty("created")]
        public DateTime Created { get; set; }

        [Column(Name= "updated", ServerTime = DateTimeKind.Local, DbType = "datetime(0) NOT NULL")]
        [JsonProperty("updated")]
        public DateTime Updated { get; set; }
    }
}
